package com.cscw.caishiquan.traverseFile;

import java.io.File;
import java.util.ArrayList;

/**
 * 遍历本地文件夹
 * @author SeQuence
 *
 */
public class TraverseFiles {

	private  ArrayList filelist = new ArrayList();

    public void refreshFileList(String strPath) {
        File dir = new File(strPath);
        File[] files = dir.listFiles();
       
        if (files == null)
            return;
        for (int i = 0; i < files.length; i++) {
            if (files[i].isDirectory()) {
                refreshFileList(files[i].getAbsolutePath());
            } else {
                String strFileName = files[i].getAbsolutePath().toLowerCase();
                System.out.println("—"+strFileName);
                filelist.add(files[i].getAbsolutePath());                   
            }
        }
    }
    
    public static void main(String[] args) {
        long a = System.currentTimeMillis();
        
        new TraverseFiles().refreshFileList("E:\\java");
        System.out.println("System.currentTimeMillis() – "+a);
    }
}
